<#include "/common/head.ftl">

<html>

<head>

<title>Attendance - ${model.offering.name}</title>

<style type="text/css">

table.nameTable {
	empty-cells:show;
	border-top: 1px solid black;
	border-right: 1px solid black;
}

table.nameTable tr {
	
}

table.nameTable tr td {
	border-left: 1px solid black;
	border-bottom: 1px solid black;
}

</style>	
	
</head>

<body style="padding:0cm">

<div style="width:27.5cm;text-align:left;margin:0cm;padding:0px">

<h2 style="text-align:center;padding-top:0cm;margin:0cm">ATTENDANCE LIST</h2>

<div style="height:3cm;font-size:10pt">
	<div style="float:left;width:8cm;height:2.3cm;margin-left:0.5cm;font-size:10pt">
		<table style="font-weight:bold;font-size:10pt;">
			<tr>
				<td style="text-align:right">Class :</td>
				<td>${model.offering.name}</td>
			</tr>
			<tr>
				<td style="text-align:right">Time :</td>
				<td>${(model.offering.shift.startTime?time)!}-${(model.offering.shift.endTime?time)!}</td>
			</tr>
			<tr>
				<td style="text-align:right">Teachers :</td>
				<td>
					<#list model.offering.instructors as teacher>
						${i18n.getMessage(teacher.title.key)} ${teacher.firstName}<#if teacher_index + 1 < model.offering.instructors.size()>, </#if>
					</#list>
				</td>
			</tr>
			<tr>
				<td style="text-align:right">Date :</td>
				<td>${model.offering.startDate?date} - ${model.offering.endDate?date}</td>
			</tr>
			<tr>
				<td style="text-align:right">Room :</td>
				<td>${(model.offering.room.code)!}</td>
			</tr>
		</table>
	</div>
	
	<div style="float:left;width:8cm;height:2.3cm;margin-left:8cm;margin-top:0.5cm">
		<div style="border:1px solid black;padding:0.1cm">
			If you have any suggestions, <br/>
			please note in the follow-up register
		</div>
		<br/>		
		<span style="font-weight:bold;margin-top:1cm">NO RECEIPT, NO ADMITTANCE</span>
	</div>
</div>

<table class="nameTable" border="0" style="solid black;width:100%;margin-left:0cm;padding:0cm" cellspacing="0" cellpadding=0">
	<tr style="text-align:center;font-weight:bold;height:0.5cm;font-size:9pt">
		<td rowspan="3" style="background-color:F0FFF0">No.</td>
		<td rowspan="3" colspan="2" style="background-color:F0FFF0">Full Name</td>
		<td rowspan="3" style="background-color:F0FFF0">Nickname</td>
		<td rowspan="3" style="width:2cm;background-color:F0FFF0">Phone</td>
		<td rowspan="3" style="background-color:F0FFF0;">Receipt</td>
		<#list model.months as month>
			<td colspan="${model.getDays(month)}">${month}</td>
		</#list>
	</tr>
	<tr style="text-align:center;height:0.5cm;font-size:9pt">
		<#list model.weeks.keySet() as week>
			<td colspan="${model.weeks.get(week)}" style="background-color:F0FFF0">Week ${week_index + fromWeek}</td>
		</#list>
	</tr>
	<tr style="text-align:center;height:0.5cm;font-size:9pt">
		<#list model.days as day>
			<td style="width:0.6cm">${day?string('d')}</td>
		</#list>
	</tr>
	<#assign memberCount = (model.offeringMembers.size())!>
	<#assign addCount = (20 - model.offeringMembers.size())!>
	<#assign removeRow = 0>
	<#if addCount < 0>
		<#assign addCount = 0>	
	</#if>
	<#list model.offeringMembers as member>
		<tr style="font-size:9pt;height:0.6cm">
			<td style="width:0.7cm;height:0.5cm;text-align:center">${member_index + 1}</td>
			<td style="width:3.5cm;border-right:0cm">${(member.receipt.student.lastName)!'&nbsp'}</td>
			<td style="width:1cm;border-left:0cm">${(member.receipt.student.firstName)!'&nbsp'}</td>
			<td style="width:1cm;border-right:0cm;text-align:center">${(member.receipt.student.nickName)!'&nbsp'}</td>
			<td>${(View.trimPhoneNumber(member.receipt.student.phoneNumber))!'&nbsp'}</td>
			<td style="width:2.5cm;padding:0cm;text-align:center" nowrap="nowrap">${(member.receipt.number)!'&nbsp'}</td>
			<#list model.days as day>
				<#assign s = model.interrupted(day)>
				<#if s == 1>
					<#if member_index == 0>
						<#assign removeRow = removeRow + 1>
						<td rowspan="${model.offeringMembers.size() + addCount}" style="font-weight:bold;text-align:center">C<br/>A<br/>N<br/>C<br/>E<br/>L</td>
					</#if>
				<#elseif s == 2>
					<#if member_index == 0>
						<#assign removeRow = removeRow + 1>
						<td rowspan="${model.offeringMembers.size() + addCount}" style="font-weight:bold;text-align:center">H<br/>O<br/>L<br/>I<br/>D<br/>A<br/>Y</td>
					</#if>
				<#else>
					<td style="text-align:center">${(i18n.getMessage(member.getAttendance(day).status.key))!'&nbsp;'}</td>
				</#if>
			</#list>
		</tr>
	</#list>
	<#list 1..addCount as i>
		<tr style="font-size:9pt;height:0.6cm">
			<td style="width:0.7cm;height:0.5cm;text-align:center">${model.offeringMembers.size() + i}</td>
			<td style="width:3cm;border-right:0cm">&nbsp</td>
			<td style="width:1cm;border-left:0cm">&nbsp</td>
			<td style="width:1cm">&nbsp</td>
			<td>&nbsp</td>
			<td style="width:1cm;padding:0cm;text-align:center">&nbsp</td>
			<#list model.days as day>
				<#assign s = model.interrupted(day)>
				<#if s == 1>
				<#elseif s == 2>
				<#else>
					<td style="text-align:center">&nbsp;</td>
				</#if>
			</#list>
		</tr>
	</#list>
</table>

<div style="text-align:left">
	<table>
		<tr>
			<td valign="top" style="padding-right: 5px">
				<b>* <u>Note:</u></b>
			</td>
			<td>
				<li>Please put<b>"A"</b> for absent students, and check <b>"P"</b> for present ones</li>
				<li>Leaving cells blank means "Absent"</li>
				<li>Please do not make any changes on the Attendance Sheet and be responsible for the accuracy of attendance checking</li>
			</td>
		</tr>
	</table>
</div>

</div>

</body>
</html>